package com.example.demo1.controller;
import com.example.demo1.entity.User;
import com.example.demo1.service.UserService;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;


@Log4j
@Controller
public class UserController{
    @Autowired
    private UserService userService;

    @RequestMapping("UserController/login")
    @ResponseBody
    public User doLogin(@RequestBody User user)  {
         return userService.selectUserByLo(user);
    }
    @RequestMapping("/UserController/register")
    @ResponseBody
    public Map<String, Object> doRegister(@RequestBody User user) {
         return userService.addUser(user);
    }
}

